// 家庭媒体管理系统 - 主要样式文件

// 使用现代@use语法导入glassmorphism混合器
@use 'glassmorphism' as glass;

// ================================
// 全局重置和基础样式
// ================================

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

*::before,
*::after {
  box-sizing: border-box;
}

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: $font-family-primary;
  font-size: $font-size-base;
  font-weight: $font-weight-normal;
  line-height: 1.6;
  color: $gray-800;
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.1) 0%,
    rgba(236, 72, 153, 0.1) 100%
  ), $gray-50;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

// ================================
// 应用根容器
// ================================

#app {
  min-height: 100vh;
  position: relative;
}

// ================================
// 通用工具类
// ================================

// 文本工具类
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-xs { font-size: $font-size-xs; }
.text-sm { font-size: $font-size-sm; }
.text-base { font-size: $font-size-base; }
.text-lg { font-size: $font-size-lg; }
.text-xl { font-size: $font-size-xl; }
.text-2xl { font-size: $font-size-2xl; }
.text-3xl { font-size: $font-size-3xl; }

.font-light { font-weight: $font-weight-light; }
.font-normal { font-weight: $font-weight-normal; }
.font-medium { font-weight: $font-weight-medium; }
.font-semibold { font-weight: $font-weight-semibold; }
.font-bold { font-weight: $font-weight-bold; }

// 颜色工具类
.text-primary { color: $primary-500; }
.text-success { color: $success; }
.text-warning { color: $warning; }
.text-error { color: $error; }
.text-info { color: $info; }

.text-gray-400 { color: $gray-400; }
.text-gray-500 { color: $gray-500; }
.text-gray-600 { color: $gray-600; }
.text-gray-700 { color: $gray-700; }
.text-gray-800 { color: $gray-800; }
.text-gray-900 { color: $gray-900; }

// 间距工具类
.m-0 { margin: 0; }
.m-1 { margin: $spacing-1; }
.m-2 { margin: $spacing-2; }
.m-3 { margin: $spacing-3; }
.m-4 { margin: $spacing-4; }
.m-5 { margin: $spacing-5; }
.m-6 { margin: $spacing-6; }
.m-8 { margin: $spacing-8; }

.p-0 { padding: 0; }
.p-1 { padding: $spacing-1; }
.p-2 { padding: $spacing-2; }
.p-3 { padding: $spacing-3; }
.p-4 { padding: $spacing-4; }
.p-5 { padding: $spacing-5; }
.p-6 { padding: $spacing-6; }
.p-8 { padding: $spacing-8; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: $spacing-1; }
.mt-2 { margin-top: $spacing-2; }
.mt-3 { margin-top: $spacing-3; }
.mt-4 { margin-top: $spacing-4; }
.mt-6 { margin-top: $spacing-6; }
.mt-8 { margin-top: $spacing-8; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: $spacing-1; }
.mb-2 { margin-bottom: $spacing-2; }
.mb-3 { margin-bottom: $spacing-3; }
.mb-4 { margin-bottom: $spacing-4; }
.mb-6 { margin-bottom: $spacing-6; }
.mb-8 { margin-bottom: $spacing-8; }

// Flexbox工具类
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-evenly { justify-content: space-evenly; }

.flex-1 { flex: 1; }
.flex-auto { flex: auto; }
.flex-none { flex: none; }

// Grid工具类
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }

.gap-1 { gap: $spacing-1; }
.gap-2 { gap: $spacing-2; }
.gap-3 { gap: $spacing-3; }
.gap-4 { gap: $spacing-4; }
.gap-6 { gap: $spacing-6; }
.gap-8 { gap: $spacing-8; }

// 位置工具类
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }

.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }

// 尺寸工具类
.w-full { width: 100%; }
.w-auto { width: auto; }
.w-fit { width: fit-content; }

.h-full { height: 100%; }
.h-auto { height: auto; }
.h-screen { height: 100vh; }

.min-h-screen { min-height: 100vh; }
.min-h-full { min-height: 100%; }

// 溢出工具类
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-scroll { overflow: scroll; }

.overflow-x-hidden { overflow-x: hidden; }
.overflow-y-hidden { overflow-y: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

// 显示工具类
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.hidden { display: none; }

// 边框圆角工具类
.rounded-none { border-radius: $radius-none; }
.rounded-sm { border-radius: $radius-sm; }
.rounded { border-radius: $radius-base; }
.rounded-md { border-radius: $radius-md; }
.rounded-lg { border-radius: $radius-lg; }
.rounded-xl { border-radius: $radius-xl; }
.rounded-2xl { border-radius: $radius-2xl; }
.rounded-3xl { border-radius: $radius-3xl; }
.rounded-full { border-radius: $radius-full; }

// 阴影工具类
.shadow-xs { box-shadow: $shadow-xs; }
.shadow-sm { box-shadow: $shadow-sm; }
.shadow { box-shadow: $shadow-base; }
.shadow-md { box-shadow: $shadow-md; }
.shadow-lg { box-shadow: $shadow-lg; }
.shadow-xl { box-shadow: $shadow-xl; }
.shadow-2xl { box-shadow: $shadow-2xl; }
.shadow-inner { box-shadow: $shadow-inner; }
.shadow-none { box-shadow: none; }

// 过渡动画工具类
.transition { transition: all $duration-normal $ease-out-quart; }
.transition-fast { transition: all $duration-fast $ease-out-quart; }
.transition-slow { transition: all $duration-slow $ease-out-quart; }

.transition-colors { transition: color $duration-normal, background-color $duration-normal, border-color $duration-normal; }
.transition-opacity { transition: opacity $duration-normal; }
.transition-transform { transition: transform $duration-normal $ease-out-quart; }

// 变换工具类
.transform { transform: translateZ(0); }
.scale-95 { transform: scale(0.95); }
.scale-100 { transform: scale(1); }
.scale-105 { transform: scale(1.05); }
.scale-110 { transform: scale(1.1); }

.rotate-45 { transform: rotate(45deg); }
.rotate-90 { transform: rotate(90deg); }
.rotate-180 { transform: rotate(180deg); }

.-rotate-45 { transform: rotate(-45deg); }
.-rotate-90 { transform: rotate(-90deg); }
.-rotate-180 { transform: rotate(-180deg); }

.translate-x-1 { transform: translateX($spacing-1); }
.translate-x-2 { transform: translateX($spacing-2); }
.translate-y-1 { transform: translateY($spacing-1); }
.translate-y-2 { transform: translateY($spacing-2); }

.-translate-x-1 { transform: translateX(-#{$spacing-1}); }
.-translate-x-2 { transform: translateX(-#{$spacing-2}); }
.-translate-y-1 { transform: translateY(-#{$spacing-1}); }
.-translate-y-2 { transform: translateY(-#{$spacing-2}); }

// ================================
// 自定义组件样式
// ================================

// 按钮基础样式
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: $spacing-2;
  padding: $spacing-3 $spacing-6;
  border-radius: $radius-lg;
  font-family: $font-family-primary;
  font-weight: $font-weight-medium;
  font-size: $font-size-sm;
  line-height: 1.2;
  text-decoration: none;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all $duration-normal $ease-out-quart;
  
  &:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
  }
  
  // 流光效果
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
      transparent 0%,
      rgba(255, 255, 255, 0.2) 50%,
      transparent 100%);
    transition: left $duration-slow ease;
  }
  
  &:hover::before {
    left: 100%;
  }
  
  &:active {
    transform: scale(0.98);
  }
}

// 按钮变体
.btn-primary {
  background: $gradient-primary;
  color: white;
  box-shadow: $shadow-md;
  
  &:hover {
    box-shadow: $shadow-lg, $glow-primary;
    transform: translateY(-2px);
  }
}

.btn-secondary {
  @include glass.glassmorphism(0.1, 20px, 0.2);
  color: $primary-600;
  
  &:hover {
    background: rgba(99, 102, 241, 0.1);
    box-shadow: $shadow-md;
  }
}

.btn-glass {
  @include glass.glassmorphism(0.15, 16px, 0.18);
  color: $gray-700;
  
  &:hover {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: $shadow-glass, $shadow-md;
  }
}

// 输入框样式
.input {
  width: 100%;
  padding: $spacing-3 $spacing-4;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: $radius-lg;
  font-family: $font-family-primary;
  font-size: $font-size-base;
  background: white;
  color: $gray-800;
  transition: all $duration-normal ease;
  
  &:focus {
    outline: none;
    border-color: $primary-500;
    box-shadow: 0 0 0 3px rgba($primary-500, 0.1);
  }
  
  &::placeholder {
    color: $gray-400;
  }
  
  &:disabled {
    background: $gray-100;
    color: $gray-500;
    cursor: not-allowed;
  }
}

// 卡片样式
.card {
  @include glass.glass-card;
  
  .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: $spacing-6 $spacing-6 $spacing-4;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    
    .card-title {
      font-size: $font-size-lg;
      font-weight: $font-weight-semibold;
      color: $gray-800;
      margin: 0;
    }
  }
  
  .card-content {
    padding: $spacing-6;
  }
  
  .card-footer {
    padding: $spacing-4 $spacing-6;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}

// ================================
// 响应式样式
// ================================

@media (max-width: $breakpoint-sm) {
  .container {
    padding: 0 $spacing-4;
  }
  
  .card {
    margin: $spacing-3;
    padding: $spacing-4;
  }
  
  .btn {
    padding: $spacing-3 $spacing-4;
    font-size: $font-size-sm;
  }
}

@media (max-width: $breakpoint-md) {
  .grid-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  
  .grid-cols-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  
  .hidden-mobile {
    display: none;
  }
}

@media (min-width: $breakpoint-lg) {
  .hidden-desktop {
    display: none;
  }
}

// ================================
// 暗色主题样式
// ================================

[data-theme="dark"] {
  body {
    color: $gray-200;
    background: $dark-gradient-primary;
  }
  
  .input {
    background: $dark-surface;
    border-color: $dark-glass-border;
    color: $gray-200;
    
    &::placeholder {
      color: $gray-500;
    }
    
    &:focus {
      border-color: $primary-400;
      box-shadow: 0 0 0 3px rgba($primary-400, 0.1);
    }
  }
  
  .card .card-title {
    color: $gray-200;
  }
  
  .text-gray-800 { color: $gray-200; }
  .text-gray-700 { color: $gray-300; }
  .text-gray-600 { color: $gray-400; }
}

// ================================
// 滚动条样式
// ================================

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: $radius-lg;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: $radius-lg;
  
  &:hover {
    background: rgba(0, 0, 0, 0.3);
  }
}

[data-theme="dark"] {
  ::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
  }
  
  ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    
    &:hover {
      background: rgba(255, 255, 255, 0.3);
    }
  }
}

// ================================
// 选中样式
// ================================

::selection {
  background: rgba($primary-500, 0.2);
  color: $primary-800;
}

::-moz-selection {
  background: rgba($primary-500, 0.2);
  color: $primary-800;
}